/**
 * 
 */
package com.feib.stms.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;


/**
 * @title (#)User.java<br>
 * @description 使用者資料<br>
 * @author Jimmy Liu<br>
 * @version 1.0.0 2010/11/25
 * @copyright Far Eastern International Bank Copyright (c) 2010<br>
 * @20101025 create by Jimmy Liu<br>
 */
public class User extends AuditEntity {

	private static final long serialVersionUID = -2153357485126061383L;

	/**
	 * PK in Table
	 */
	private Long userPk;

	/**
	 * 所屬群組
	 */
	private Group group;
	
	/**
	 * 所屬券商<br/>
	 * 目前只有顯示使用
	 */
	private Securities securities;

	/**
	 * 登入帳號，unique key
	 */
	private String userId;

	/**
	 * 登入密碼
	 */
	private String userPwd;

	/**
	 * 登入姓名
	 */
	private String userName;

	/**
	 * Email
	 */
	private String userEmail;

	/**
	 * Phone number
	 */
	private String userPhoneNo;

	/** 
	 * 帳號啟用 <li>true: 啟用</li> <li>false: 停用</li><br/>
	 * Indicates whether the user is enabled or disabled. A disabled user cannot be authenticated.<br/>
	 */
	private Boolean enabled;

	/**
	 * 帳號鎖定 <li>true: 是</li> <li>false: 否</li><br/>
	 * Indicates whether the user is locked or unlocked. A locked user cannot be authenticated.
	 */
	private Boolean locked;

	/**
	 * 密碼有效日期
	 */
	private Date pwdExpiredDate;

	/**
	 * 最近一次登入時間/上次登入時間
	 */
	private Date lastLoginDate;

	/**
	 * 密碼歷史記錄
	 */
	private String pwdHistory;

	/**
	 * 密碼登錄錯誤次數
	 */
	private Integer pwdErrorTime;

	/**
	 * 認證碼錯誤次數
	 */
	private Integer captchaErrorTime;

	/**
	 * 備註
	 */
	private String userNote;


	/**	
	 * 憑證序號 
	 */
	private String certificateKey;


	/** 			
	 * 可處理券商資料<br/>
	 * 以逗號分開<br/> 
	 */
	private String dealSecuritiesNos;

	/**
	 * 使用者角色
	 */
	private Set<Role> roles;

	/**
	 * 使用者登入控制
	 */
	private UserLoginControl userLoginControl;

	public Integer getCaptchaErrorTime() {
		return captchaErrorTime;
	}

	public void setCaptchaErrorTime(Integer captchaErrorTime) {
		this.captchaErrorTime = captchaErrorTime;
	}

	public String getCertificateKey() {
		return certificateKey;
	}

	public void setCertificateKey(String certificateKey) {
		this.certificateKey = certificateKey;
	}

	public String getDealSecuritiesNos() {
		return dealSecuritiesNos;
	}

	public void setDealSecuritiesNos(String dealSecuritiesNos) {
		this.dealSecuritiesNos = dealSecuritiesNos;
	}

	public Boolean getEnabled() {
		return enabled;
	}

	public void setEnabled(Boolean enabled) {
		this.enabled = enabled;
	}

	public Group getGroup() {
		return group;
	}

	public void setGroup(Group group) {
		this.group = group;
	}

	public Date getLastLoginDate() {
		return lastLoginDate;
	}

	public void setLastLoginDate(Date lastLogingDate) {
		this.lastLoginDate = lastLogingDate;
	}

	public Boolean getLocked() {
		return locked;
	}

	public void setLocked(Boolean locked) {
		this.locked = locked;
	}

	public Integer getPwdErrorTime() {
		return pwdErrorTime;
	}

	public void setPwdErrorTime(Integer pwdErrorTime) {
		this.pwdErrorTime = pwdErrorTime;
	}

	public Date getPwdExpiredDate() {
		return pwdExpiredDate;
	}

	public void setPwdExpiredDate(Date pwdExpiredDate) {
		this.pwdExpiredDate = pwdExpiredDate;
	}

	public String getPwdHistory() {
		return pwdHistory;
	}

	public void setPwdHistory(String pwdHistory) {
		this.pwdHistory = pwdHistory;
	}

	public Set<Role> getRoles() {
		return roles;
	}

	public void setRoles(Set<Role> roles) {
		this.roles = roles;
	}

	public String getUserEmail() {
		return userEmail;
	}

	public void setUserEmail(String userEmail) {
		this.userEmail = userEmail;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public UserLoginControl getUserLoginControl() {
		return userLoginControl;
	}

	public void setUserLoginControl(UserLoginControl userLoginControl) {
		this.userLoginControl = userLoginControl;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getUserNote() {
		return userNote;
	}

	public void setUserNote(String userNote) {
		this.userNote = userNote;
	}

	public String getUserPhoneNo() {
		return userPhoneNo;
	}

	public void setUserPhoneNo(String userPhoneNo) {
		this.userPhoneNo = userPhoneNo;
	}

	public Long getUserPk() {
		return userPk;
	}

	public void setUserPk(Long userPk) {
		this.userPk = userPk;
	}

	public String getUserPwd() {
		return userPwd;
	}

	public void setUserPwd(String userPwd) {
		this.userPwd = userPwd;
	}

	public Securities getSecurities() {
		return securities;
	}

	public void setSecurities(Securities securities) {
		this.securities = securities;
	}

	
	

	
	public void addRole(Role e)
    {
        if (null == this.getRoles()) this.roles = new HashSet<Role>();
        this.roles.add(e);
    }

}
